<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
	xmlns:a="http://richfaces.org/a4j"
    template="/layout/template.xhtml">

<ui:define name="body">

<rich:panel styleClass="acab_top_aligned_box">
<h:panelGrid columns="2">

	<rich:panel >
		<f:facet name="header">These are the travels in which I am interested in!</f:facet>   
		<h:panelGrid>
		
			<h:outputText value="D'oh!Not interested in any travel yet?!?!"
               rendered="#{empty interestingTravelsBean.interestingTravelDialogs}"/>


		    <rich:dataTable id="interestingTravelsTable"
		                var="_dialog"
		              value="#{interestingTravelsBean.interestingTravelDialogs}"
		           rendered="#{not empty interestingTravelsBean.interestingTravelDialogs}" >

		        <h:column>
		            <f:facet name="header">Name</f:facet>
		            
		            <h:form>		
           				<s:link 
           					value="#{_dialog.travel.name}"
           					view="/acab/travel/TravelDetails.xhtml" 
           					action="#{travelDetailsBean.selectTravelAction}" >
			  				<f:param name="idTravel" value="#{_dialog.travel.idTravel}"/>
						</s:link>
					</h:form>
		            
		            
		        </h:column>
		        
		        <h:column>
		            <f:facet name="header">From</f:facet>
		            #{'('}
		            <h:outputText value="#{_dialog.travel.fromLat}"/>
		            #{' , '}
		            <h:outputText value="#{_dialog.travel.fromLon}"/>
		            #{')'}
					
					

		        </h:column>

		        <h:column>
		            <f:facet name="header">To</f:facet>
		            #{'('}
		            <h:outputText value="#{_dialog.travel.toLat}"/>
		            #{' , '}
		            <h:outputText value="#{_dialog.travel.toLon}"/>
		            #{')'}
		            
		            
		        </h:column>
		        
		        <h:column>
		            <f:facet name="header">Distance</f:facet>
					<h:outputText value="#{_dialog.travel.distance}Km."/>
		        </h:column>
		        
		        <h:column>
		            <f:facet name="header">Date/Period</f:facet>

					<h:outputText value="#{_dialog.travel.beginDate}" >
						<f:convertDateTime type="date" dateStyle="short"/>
					</h:outputText>
					<h:outputText  rendered="#{!_dialog.travel.singleDay}"> to </h:outputText>
					<h:outputText value="#{_dialog.travel.endDate}" rendered="#{!_dialog.travel.singleDay}">
						<f:convertDateTime type="date" dateStyle="short"/>
					</h:outputText>
					<h:outputText value="..." rendered="#{!_dialog.travel.singleDay and _dialog.travel.endDate==null}"/>
		        </h:column>
		        
		        <h:column>
		            <f:facet name="header">Conversation</f:facet>
		            
		            <h:form> 
	                <a:commandLink id="selectDialog" ajaxSingle="true" actionListener="#{interestingTravelsBean.selectDialogActionListener}" reRender="conversationPanelId"> 
	                	<s:graphicImage value="#{_dialog.otherSeenDate.before(_dialog.lastCommentDate) ? '/img/icons/conv_orange.gif': '/img/icons/conv_blue.gif'}" height="22"/> 
	                	<f:param name="selectedDialogId" value="#{_dialog.idDialog}"/>
					</a:commandLink>
					</h:form>
		            
					
		        </h:column>
		        
			</rich:dataTable>
		  
		</h:panelGrid>
	</rich:panel>	
	
	
	
	
	<rich:panel bodyClass="inpanelBody" id="conversationPanelId">
		<f:facet name="header">Conversation:</f:facet>
			
		<h:form styleClass="edit" >
			<h:inputTextarea cols="50" rows="5" value="#{interestingTravelsBean.newMessage}"/>
			
			<div class="actionButtons">
				<a:commandButton value="Send"   actionListener="#{interestingTravelsBean.otherSendMessageActionListener}" reRender="conversationPanelId"/>
       		</div>

   		</h:form>
			
		<h:outputText value="The dialog has no comments?!?! weird!" rendered="#{empty interestingTravelsBean.dialogComments}"/>

		<rich:dataTable id="dialogCommentList"
           	var="_comm"
      		value="#{interestingTravelsBean.dialogComments}"
   			rendered="#{not empty interestingTravelsBean.dialogComments}">
   			
   			<h:column>
       			<h:outputText value="#{_comm.msg}"/>
   			</h:column>
   		</rich:dataTable>
			
	</rich:panel>
	
	
</h:panelGrid>
</rich:panel>
	
	
		
        
        
</ui:define>
</ui:composition>
	